Debian 9 Stretch
Sponsored Link

OpenStack Newton : Neutron Networking(VXLAN)
2017/07/03
 
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure VXLAN type of networking on here.
Before it, Configure basic settings on Control Node, Network Node, Compute Node.
Furthermore, this example is based on the environment that Network Node has 2 network interfaces.
     ------------+--------------------------------+--------------------------------+------------
                 |                                |                                |
             eth0|10.0.0.30                   eth0|10.0.0.50                   eth0|10.0.0.51
     +-----------+-----------+        +-----------+-----------+        +-----------+-----------+
     |    [ Control Node ]   |        |    [ Network Node ]   |        |    [ Compute Node ]   |
     |                       |        |                       |        |                       |
     |  MariaDB    RabbitMQ  |        |                       |eth1    |        Libvirt        |
     |  Memcached  httpd     |        |  L2,L3,Metadata Agent +----    |      Nova Compute     |
     |  Keystone   Glance    |        |                       |        |        L2 Agent       |
     |  Nova API             |        |                       |        |                       |
     |  Neutron Server       |        |                       |        |                       |
     +-----------------------+        +-----------------------+        +-----------------------+

[1] Change settings on Control Node.
root@dlp ~(keystone)#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 94: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 129: change

flat_networks =
physnet1
# line 171: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@dlp ~(keystone)#
systemctl restart neutron-server

[2] Change settings on Network Node.
# add bridge

root@network:~#
ovs-vsctl add-br br-eth1

# add eth1 to a bridge port

root@network:~#
ovs-vsctl add-port br-eth1 eth1

root@network:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 94: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 129: change

flat_networks =
physnet1
# line 171: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@network:~#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 99: uncomment and change

tunnel_types =
vxlan
# line 180: uncomment and change

bridge_mappings =
physnet1:br-eth1
root@network:~#
for service in l3-agent dhcp-agent metadata-agent openvswitch-agent; do
systemctl restart neutron-$service
done

[3] Change settings on Compute Node.
root@node01:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 94: add a value to tenant_network_types

tenant_network_types =
vxlan
# line 129: change

flat_networks =
physnet1
# line 171: add

[ml2_type_vxlan]
vni_ranges = 1:1000
root@node01:~#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 99: uncomment and change

tunnel_types =
vxlan
root@node01:~#
systemctl restart neutron-openvswitch-agent

[4] Create a Virtual router. It's OK to work on any node. (This example is on Control Node)
root@dlp ~(keystone)#
openstack router create router01

Created a new router:
+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      |                                      |
| created_at              | 2017-07-06T07:29:08Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | null                                 |
| flavor_id               | None                                 |
| ha                      | False                                |
| headers                 |                                      |
| id                      | 5e8f17a6-8808-4644-acd3-0cb6016bad51 |
| name                    | router01                             |
| project_id              | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id              | aa50ee91b9f748a38d9e1643006b6bd1     |
| revision_number         | 2                                    |
| routes                  |                                      |
| status                  | ACTIVE                               |
| updated_at              | 2017-07-06T07:29:08Z                 |
+-------------------------+--------------------------------------+
[5] Create internal network and associate with the router above.
# create internal network

root@dlp ~(keystone)#
openstack network create int_net --provider-network-type vxlan

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-07-06T07:29:27Z                 |
| description               |                                      |
| headers                   |                                      |
| id                        | d8259723-ca53-4f6e-8bd6-b7787775dfe8 |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| mtu                       | 1450                                 |
| name                      | int_net                              |
| port_security_enabled     | True                                 |
| project_id                | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id                | aa50ee91b9f748a38d9e1643006b6bd1     |
| provider:network_type     | vxlan                                |
| provider:physical_network | None                                 |
| provider:segmentation_id  | 39                                   |
| revision_number           | 3                                    |
| router:external           | Internal                             |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      | []                                   |
| updated_at                | 2017-07-06T07:29:27Z                 |
+---------------------------+--------------------------------------+

# create subnet in the internal network

root@dlp ~(keystone)#
openstack subnet create subnet1 --network int_net \
--subnet-range 192.168.100.0/24 --gateway 192.168.100.1 \
--dns-nameserver 10.0.0.10

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 192.168.100.2-192.168.100.254        |
| cidr              | 192.168.100.0/24                     |
| created_at        | 2017-07-06T07:29:48Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | True                                 |
| gateway_ip        | 192.168.100.1                        |
| headers           |                                      |
| host_routes       |                                      |
| id                | f9cf78f4-3702-4894-9f3b-755b541fc162 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet1                              |
| network_id        | d8259723-ca53-4f6e-8bd6-b7787775dfe8 |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| revision_number   | 2                                    |
| service_types     | []                                   |
| subnetpool_id     | None                                 |
| updated_at        | 2017-07-06T07:29:48Z                 |
+-------------------+--------------------------------------+

# set internal network to the router above

root@dlp ~(keystone)#
openstack router add subnet router01 subnet1

[6] Create external network and associate with the router above.
# create external network

root@dlp ~(keystone)#
openstack network create \
--provider-physical-network physnet1 \
--provider-network-type flat --external ext_net

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-07-06T07:30:12Z                 |
| description               |                                      |
| headers                   |                                      |
| id                        | 3bbaadd7-6da0-494b-950d-489566b78713 |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | ext_net                              |
| port_security_enabled     | True                                 |
| project_id                | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id                | aa50ee91b9f748a38d9e1643006b6bd1     |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | None                                 |
| revision_number           | 3                                    |
| router:external           | External                             |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      | []                                   |
| updated_at                | 2017-07-06T07:30:12Z                 |
+---------------------------+--------------------------------------+

# create subnet in external network

root@dlp ~(keystone)#
openstack subnet create subnet2 \
--network ext_net --subnet-range 10.0.0.0/24 \
--allocation-pool start=10.0.0.200,end=10.0.0.254 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.10 --no-dhcp

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 10.0.0.200-10.0.0.254                |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2017-07-06T07:30:32Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | False                                |
| gateway_ip        | 10.0.0.1                             |
| headers           |                                      |
| host_routes       |                                      |
| id                | 688823d2-605c-4208-a42c-0622d182abf6 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet2                              |
| network_id        | 3bbaadd7-6da0-494b-950d-489566b78713 |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| revision_number   | 2                                    |
| service_types     | []                                   |
| subnetpool_id     | None                                 |
| updated_at        | 2017-07-06T07:30:32Z                 |
+-------------------+--------------------------------------+

# set gateway to the router above

root@dlp ~(keystone)#
neutron router-gateway-set \
$(openstack router list | grep router01 | awk '{ print $2 }') \
$(openstack network list | grep ext_net | awk '{ print $2 }')
[7] Create and start Virtual machine Instance.
root@dlp ~(keystone)#
Int_Net_ID=`openstack network list | grep int_net | awk '{ print $2 }'`

root@dlp ~(keystone)#
openstack image list

+--------------------------------------+---------+--------+
| ID                                   | Name    | Status |
+--------------------------------------+---------+--------+
| a44f263f-be6c-4b7a-b23e-228f8cf396ca | Debian9 | active |
+--------------------------------------+---------+--------+

root@dlp ~(keystone)#
openstack server create --flavor m1.small --image Debian9 --security-group default --nic net-id=$Int_Net_ID Debian_9

root@dlp ~(keystone)#
openstack server list

+--------------------------------------+----------+--------+-----------------------+------------+
| ID                                   | Name     | Status | Networks              | Image Name |
+--------------------------------------+----------+--------+-----------------------+------------+
| bab79aeb-5e1f-4331-83f0-ff6cc662b13d | Debian_9 | ACTIVE | int_net=192.168.100.3 | Debian9    |
+--------------------------------------+----------+--------+-----------------------+------------+
[8] Assign floating IP address to the Instance above.
root@dlp ~(keystone)#
openstack floating ip create ext_net

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-07-06T07:34:24Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.204                           |
| floating_network_id | 3bbaadd7-6da0-494b-950d-489566b78713 |
| headers             |                                      |
| id                  | a8e89629-6f9c-4258-9a43-55cb3153b48b |
| port_id             | None                                 |
| project_id          | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id          | aa50ee91b9f748a38d9e1643006b6bd1     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-07-06T07:34:24Z                 |
+---------------------+--------------------------------------+

root@dlp ~(keystone)#
openstack server add floating ip Debian_9 10.0.0.204

# show settings

root@dlp ~(keystone)#
openstack floating ip show 10.0.0.204

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-07-06T07:34:24Z                 |
| description         |                                      |
| fixed_ip_address    | 192.168.100.3                        |
| floating_ip_address | 10.0.0.204                           |
| floating_network_id | 3bbaadd7-6da0-494b-950d-489566b78713 |
| id                  | a8e89629-6f9c-4258-9a43-55cb3153b48b |
| port_id             | 223c25e0-d149-40d9-bcd4-255158cbfb4e |
| project_id          | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id          | aa50ee91b9f748a38d9e1643006b6bd1     |
| revision_number     | 2                                    |
| router_id           | 5e8f17a6-8808-4644-acd3-0cb6016bad51 |
| status              | ACTIVE                               |
| updated_at          | 2017-07-06T07:34:44Z                 |
+---------------------+--------------------------------------+
[9] Configure security settings like follows to access with SSH and ICMP.
# permit ICMP

root@dlp ~(keystone)#
openstack security group rule create --protocol icmp --ingress default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-07-06T07:35:12Z                 |
| description       |                                      |
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| headers           |                                      |
| id                | 8fcf2c23-361d-467d-9293-4519276900df |
| port_range_max    | None                                 |
| port_range_min    | None                                 |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| protocol          | icmp                                 |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | c2471cef-b570-46ac-8a5d-088547c4b8c5 |
| updated_at        | 2017-07-06T07:35:12Z                 |
+-------------------+--------------------------------------+

# permit SSH

root@dlp ~(keystone)#
openstack security group rule create --protocol tcp --dst-port 22:22 default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-07-06T07:35:26Z                 |
| description       |                                      |
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| headers           |                                      |
| id                | 1ff0166a-6c14-4580-b638-bf23bb45815c |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| project_id        | aa50ee91b9f748a38d9e1643006b6bd1     |
| protocol          | tcp                                  |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | c2471cef-b570-46ac-8a5d-088547c4b8c5 |
| updated_at        | 2017-07-06T07:35:26Z                 |
+-------------------+--------------------------------------+

root@dlp ~(keystone)#
openstack security group rule list

+-----------+-------------+-----------+------------+--------------------------+---------------------+
| ID        | IP Protocol | IP Range  | Port Range | Remote Security Group    | Security Group      |
+-----------+-------------+-----------+------------+--------------------------+---------------------+
| 1ff0166a- | tcp         | 0.0.0.0/0 | 22:22      | None                     | c2471cef-b570-46ac- |
| 5414cf34- | None        | None      |            | c2471cef-b570-46ac-8a5d- | c2471cef-b570-46ac- |
| 7161b00c- | None        | None      |            | None                     | c2471cef-b570-46ac- |
| 8fcf2c23- | icmp        | 0.0.0.0/0 |            | None                     | c2471cef-b570-46ac- |
| 99774862- | None        | None      |            | c2471cef-b570-46ac-8a5d- | c2471cef-b570-46ac- |
| ef685e2b- | None        | None      |            | None                     | c2471cef-b570-46ac- |
+-----------+-------------+-----------+------------+--------------------------+---------------------+
[10] It's possible to login to the Instance to connect to the IP address with SSH like follows.
root@dlp ~(keystone)#
ssh debian@10.0.0.204

The authenticity of host '10.0.0.204 (10.0.0.204)' can't be established.
ECDSA key fingerprint is SHA256:8BCoEq/qE1pI3cVawS3cZdAk8xCctjljkrAVwPZAMRU.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.204' (ECDSA) to the list of known hosts.
debian@10.0.0.204's password:
Linux debian.srv.world 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@debian:~$    
# just logined
 
Tweet